/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package util;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

/**
 *
 * @author ebeltran
 */
public class MyResulsetToList {
    
    public static final List ResulsetToList(ResultSet rst, List wantedColumnNames) throws SQLException  
    {  
        List filas = new ArrayList();  
   
        int numColumns = wantedColumnNames.size();  
        while (rst.next())  
        {  
            Map row = new LinkedHashMap();  
   
            for (int i = 0; i < numColumns; ++i)  
            {  
                String columnName   = (String)wantedColumnNames.get(i);  
                Object value = rst.getObject(columnName);  
                row.put(columnName, value);  
            }  
   
            filas.add(row);  
        }  
   
        return filas;  
    }
    
}
